cmake_minimum_required(VERSION 3.12)

project(nextengine)

option(BUILD_WITH_EASY_PROFILER "Enable EasyProfiler usage" OFF)
option(BUILD_WITH_OPTICK "Enable Optick usage" OFF)

SET(CMAKE_CXX_STANDARD 20)

# set include and lib dirs
IF (WIN32)
    # setup for windows
    SET(GLFW3_INCLUDE_DIR "D:/Libs/glfw/include/")
    SET(GLFW3_LIBRARY "D:/Libs/glfw/lib/glfw3.lib")

    SET(ASSIMP_INCLUDE_DIR "D:/Libs/assimp/include/")
    SET(ASSIMP_LIBRARY "D:/Libs/assimp/lib/Debug/assimp-vc142-mtd.lib")
    
    # SET(STBIMAGE_INCLUDE_DIR "D:/Libs/stb_image/include")
    # SET(TINYOBJLOADER_INCLUDE_DIR "D:/Libs/tinyobjloader/include")

    SET(GLM_INCLUDE_DIR "D:/Libs/glm/include")
    SET(GLI_INCLUDE_DIR "D:/Libs/gli/include")
    SET(TASKFLOW_INCLUDE_DIR "D:/Libs/taskflow/include")

    SET(VK_INCLUDE_DIR "C:/VulkanSDK/1.3.268.0/Include")
    # SET(VK_LIBRARY "C:/VulkanSDK/1.3.268.0/Lib/vulkan-1.lib")
    
    SET(GLSL_INCLUDE_DIR 
        "D:/Libs/glslang/include/glslang/Include"
        "D:/Libs/glslang/include/glslang/Public"
    )
    SET(GLSL_LIBRARY 
        "D:/Libs/glslang/lib/debug/glslangd.lib"
        "D:/Libs/glslang/lib/debug/SPIRVd.lib"
        "D:/Libs/glslang/lib/debug/SPVRemapperd.lib"
        "D:/Libs/glslang/lib/debug/MachineIndependentd.lib"
        "D:/Libs/glslang/lib/debug/GenericCodeGend.lib"
        "D:/Libs/glslang/lib/debug/glslang-default-resource-limitsd.lib"
    )

    # SET(FREETYPE_INCLUDE_DIR "D:/Libs/freetype/include/")
    # SET(FREETYPE_LIBRARY "D:/Libs/freetype/lib/freetype.lib")

    SET(SOURCE_INCLUDE_DIR 
        "${PROJECT_SOURCE_DIR}/src"
        "${PROJECT_SOURCE_DIR}/src/vendor/glad/include/"
        "${PROJECT_SOURCE_DIR}/src/vendor/"
    )
    
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATIONS)
ELSE ()
    # Linux
ENDIF (WIN32)

FILE(GLOB_RECURSE SOURCE_CPP_FILES "${PROJECT_SOURCE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE SOURCE_C_FILES "${PROJECT_SOURCE_DIR}/src/*.c")
FILE(GLOB_RECURSE HEADER_FILES "${PROJECT_SOURCE_DIR}/src/*.h")


ADD_EXECUTABLE(
    engine
    ${SOURCE_CPP_FILES}
    ${SOURCE_C_FILES}
    ${HEADER_FILES}
)

TARGET_INCLUDE_DIRECTORIES(
    engine PRIVATE
    ${VK_INCLUDE_DIR}
    ${GLSL_INCLUDE_DIR}
    ${SOURCE_INCLUDE_DIR}
    ${GLFW3_INCLUDE_DIR}
    ${ASSIMP_INCLUDE_DIR}
    ${STBIMAGE_INCLUDE_DIR}
    ${GLM_INCLUDE_DIR}
    ${GLI_INCLUDE_DIR}
    ${TASKFLOW_INCLUDE_DIR}
    ${TINYOBJLOADER_INCLUDE_DIR}
    ${FREETYPE_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(
    engine
    ${VK_LIBRARY}
    ${GLFW3_LIBRARY}
    ${FREETYPE_LIBRARY}
    ${ASSIMP_LIBRARY}
    ${GLSL_LIBRARY}
)

